<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Xml.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Dtd" rel="Chapter" href="Dtd.html">
<link title="Xml" rel="Chapter" href="Xml.html">
<link title="XmlParser" rel="Chapter" href="XmlParser.html"><title>XmlParser</title>
</head>
<body>
<div class="navbar"><a href="Xml.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;</div>
<center><h1>Module <a href="type_XmlParser.html">XmlParser</a></h1></center>
<br>
<pre><span class="keyword">module</span> XmlParser: <code class="code">sig</code> <a href="XmlParser.html">..</a> <code class="code">end</code></pre>Xml Light Parser
<p>

 While basic parsing functions can be used in the <a href="Xml.html"><code class="code">Xml</code></a> module, this module
 is providing a way to create, configure and run an Xml parser.<br>
<hr width="100%">
<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre>
<div class="info">
Abstract type for an Xml parser.<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEsource"></a><code class="type"></code>source = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">SFile</span> <span class="keyword">of</span> <code class="type">string</code></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">SChannel</span> <span class="keyword">of</span> <code class="type">Pervasives.in_channel</code></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">SString</span> <span class="keyword">of</span> <code class="type">string</code></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">SLexbuf</span> <span class="keyword">of</span> <code class="type">Lexing.lexbuf</code></code></td>

</tr></table>

<div class="info">
Several kind of resources can contain Xml documents.<br>
</div>

<pre><span class="keyword">val</span> <a name="VALmake"></a>make : <code class="type">unit -> <a href="XmlParser.html#TYPEt">t</a></code></pre><div class="info">
This function returns a new parser with default options.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALprove"></a>prove : <code class="type"><a href="XmlParser.html#TYPEt">t</a> -> bool -> unit</code></pre><div class="info">
This function enable or disable automatic DTD proving with the parser. 
 Note that Xml documents having no reference to a DTD are never proved
 when parsed (but you can prove them later using the <a href="Dtd.html"><code class="code">Dtd</code></a> module
 <i>(by default, prove is true)</i>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALresolve"></a>resolve : <code class="type"><a href="XmlParser.html#TYPEt">t</a> -> (string -> <a href="Dtd.html#TYPEchecked">Dtd.checked</a>) -> unit</code></pre><div class="info">
When parsing an Xml document from a file using the <a href="Xml.html#VALparse_file"><code class="code">Xml.parse_file</code></a>
 function, the DTD file if declared by the Xml document has to be in the
 same directory as the xml file. When using other parsing functions, 
 such as on a string or on a channel, the parser will raise everytime
 <a href="Xml.html#EXCEPTIONFile_not_found"><code class="code">Xml.File_not_found</code></a> if a DTD file is needed and prove enabled. To enable
 the DTD loading of the file, the user have to configure the Xml parser
 with a <code class="code">resolve</code> function which is taking as argument the DTD filename and
 is returning a checked DTD. The user can then implement any kind of DTD
 loading strategy, and can use the <a href="Dtd.html"><code class="code">Dtd</code></a> module functions to parse and check
 the DTD file <i>(by default, the resolve function is raising</i>
 <a href="Xml.html#EXCEPTIONFile_not_found"><code class="code">Xml.File_not_found</code></a>).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcheck_eof"></a>check_eof : <code class="type"><a href="XmlParser.html#TYPEt">t</a> -> bool -> unit</code></pre><div class="info">
When a Xml document is parsed, the parser will check that the end of the
 document is reached, so for example parsing <code class="code">"&lt;A/&gt;&lt;B/&gt;"</code> will fail instead
 of returning only the A element. You can turn off this check by setting
 <code class="code">check_eof</code> to <code class="code">false</code> <i>(by default, check_eof is true)</i>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALparse"></a>parse : <code class="type"><a href="XmlParser.html#TYPEt">t</a> -> <a href="XmlParser.html#TYPEsource">source</a> -> <a href="Xml.html#TYPExml">Xml.xml</a></code></pre><div class="info">
Once the parser is configurated, you can run the parser on a any kind
 of xml document source to parse its contents into an Xml data structure.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALconcat_pcdata"></a>concat_pcdata : <code class="type"><a href="XmlParser.html#TYPEt">t</a> -> bool -> unit</code></pre><div class="info">
When several PCData elements are separed by a \n (or \r\n), you can
 either split the PCData in two distincts PCData or merge them with \n
 as seperator into one PCData. The default behavior is to concat the
 PCData, but this can be changed for a given parser with this flag.<br>
</div>
</body></html>